home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-22 | 3.4 KB | 80 lines | [TEXT/PJMM] |
- UNIT Search;
-
- { Apple Macintosh Developer Technical Support }
- { }
- { IndexedSearch and the PBCatSearch compatibility function. }
- { by Jim Luther, Apple Developer Technical Support }
- { }
- { File: Search.p }
- { }
- { Copyright © 1992-1994 Apple Computer, Inc. }
- { All rights reserved. }
- { }
- { You may incorporate this sample code into your applications without }
- { restriction, though the sample code has been provided "AS IS" and the }
- { responsibility for its operation is 100% yours. However, what you are }
- { not permitted to do is to redistribute the source as "DSC Sample Code" }
- { after having made changes. If you're going to re-distribute the source, }
- { we require that you make it clear in the source that the code was }
- { descended from Apple Sample Code, but that you've made changes. }
-
-
- INTERFACE
-
- {***************************************************************************}
-
-
- FUNCTION IndexedSearch (pb: HParmBlkPtr;
- dirID: LongInt): OSErr;
- { The IndexedSearch function performs an indexed search in and below the }
- { specified directory using the same parameters (in pb) as is passed to }
- { PBCatSearch. See Inside Macintosh: Files for a description of the }
- { parameter block. }
- { }
- { pb input: A CSParamPtr record specifying the volume to search }
- { and the search criteria. }
- { output: Fields in the parameter block are returned }
- { indicating the number of matches found, the }
- { matches, and if the search ended with noErr, the }
- { CatPosition record that lets you resume a search }
- { where the last search left off. }
- { dirID input: The directory to search. If fsRtDirID is passed, }
- { the entire volume is searched. }
- { }
- { Note: If you use a high-level debugger and use ioSearchTime to limit }
- { the length of time to run the search, you'll want to step over }
- { calls to IndexedSearch because it installs a Time Manager task. }
- { Most high-level debuggers don't deal gracefully with interrupt }
- { driven code. }
-
-
- {***************************************************************************}
-
-
- FUNCTION PBCatSearchSyncCompat (paramBlock: HParmBlkPtr): OSErr;
- { The PBCatSearchSyncCompat function uses PBCatSearch (if available) or }
- { IndexedSearch (if PBCatSearch is not available) to search a volume }
- { using a set of search criteria that you specify. It builds a list of }
- { all files or directories that meet your specifications. }
- { }
- { pb input: A CSParamPtr record specifying the volume to search }
- { and the search criteria. }
- { output: Fields in the parameter block are returned }
- { indicating the number of matches found, the }
- { matches, and if the search ended with noErr, the }
- { CatPosition record that lets you resume a search }
- { where the last search left off. }
- { }
- { Note: If you use a high-level debugger and use ioSearchTime to limit }
- { the length of time to run the search, you'll want to step over }
- { calls to PBCatSearchSyncCompat because it calls IndexedSearch }
- { which installs a Time Manager task. Most high-level debuggers }
- { don't deal gracefully with interrupt driven code. }
-
-
- {***************************************************************************}
-
-
- IMPLEMENTATION
-
- END.